'''
@File : request_data_1.py
@Time : 2022/11/22 08:59
@Author: luoman
'''
# import lib
import pytest

import requests

def get_access_token():
    access_url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential"
    param = {"appid": "wxb71ae35969722889",
             "secret": "91804f506fe88ec49999a2761743e763"}
    res = requests.get(url=access_url, params=param)
    token_data=res.json()  # 创建一个json对象
    return token_data['access_token']  # 取出access_token
# 测试成功添加标签
create_tag_success = {
        'url': "https://api.weixin.qq.com/cgi-bin/tags/create",
        'params': {
            "access_token": get_access_token()},
        'data': {"tag": {"name":'广东' }},
        'except':'tag'
    }
# 测试标签名长度超过30
create_tag_more30 = {
        'url': "https://api.weixin.qq.com/cgi-bin/tags/create",
        'params': {
            "access_token": get_access_token()},
        'data': {"tag": {"name":'fsfsfsfffrwrwerwrwrwrwr' }},
        'except':'45158'
    }
# 测试标签重复
create_tag_repeat = {
        'url': "https://api.weixin.qq.com/cgi-bin/tags/create",
        'params': {
            "access_token": get_access_token()},
        'data': {"tag": {"name":'广东' }},
        'except':'45157'
    }